package it.massetti.scoponescientifico.game;

import java.util.ArrayList;
import java.util.List;

public class Team {

	public static final int MAX_PLAYERS_IN_A_TEAM = 2;
	private List<Card> cards = new ArrayList<Card>();
	private List<Player> players = new ArrayList<Player>();
	private int number;
	private int scope;
	private int points;
	
	public Team(int teamNumber) {
		int playerNumber;
		number=teamNumber;
		for(playerNumber=0; playerNumber<MAX_PLAYERS_IN_A_TEAM; playerNumber++) {
			players.add(new Player(playerNumber, this));
		}
	}
	
	/**
	 * Gets the player in the team given an ID
	 * @param number
	 * @return player
	 */
	public Player getPlayer(int number) {
		return players.get(number);
	}
	
	/**
	 * Returns the playerID in the team
	 * @return number
	 */
	public int getNumber () {
		return number;
	}
	
	/**
	 * Take some cards
	 * @param cardsTaken
	 */
	public void take (List<Card> cardsTaken) {
		cards.addAll(cardsTaken);
	}

	/**
	 * Adds a scopa
	 */
	public void addScopa() {
		scope++;
	}
	
	/**
	 * Reset the team for a new hand
	 */
	public void reset() {
		scope=0;
		cards.clear();
	}
	
	/**
	 * Returns the number of scope in the hand
	 * @return scope
	 */
	public int getScope() {
		return scope;
	}
	
	/**
	 * Returns team cards
	 * @return cards
	 */
	public List<Card> getCards() {
		return cards;
	}

	/**
	 * Get team points
	 * @return
	 */
	public int getPoints() {
		return points;
	}

	/**
	 * Set team points
	 * @param points
	 */
	public void setPoints(int points) {
		this.points = points;
	}
}
